package it.polimi.reTraveldream.entities;

import it.polimi.reTravelDream.dto.PrenotationDTO;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: Prenotation
 *
 */
@Entity
@Table(name="Prenotations")
@NamedQueries({
	@NamedQuery(name=Prenotation.FIND_USER_PRENOTATIONS,
            query="SELECT p FROM Prenotation p WHERE p.email LIKE :userName"),
    @NamedQuery(name=Prenotation.FIND_ALL,
    		query="SELECT p2 FROM Prenotation p2")
})
public class Prenotation implements Serializable {

	
	private static final long serialVersionUID = 1L;
	public static final String FIND_USER_PRENOTATIONS = "Prenotation.findUserPrenotations";		
	public static final String FIND_ALL = "Prenotation.findAll";		


	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	private String email;
	private String packageName;
	private Flight outGoingFlight;
	private Flight returnFlight;
	private Hotel hotelChosed;
	private Excursion excursionChosed;
	private int price;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date prenotationDate;
	
	
	public Prenotation() {
	}
	
	public Prenotation(String user, String packageName,
			Flight outGoingFlight, Flight returnFlight, 
			Hotel hotelChosed, Excursion excursionChosed,int price){
		super();
		this.email=user;
		this.outGoingFlight=outGoingFlight;
		this.returnFlight=returnFlight;
		this.hotelChosed=hotelChosed;
		this.excursionChosed=excursionChosed;
		this.price=price;
		this.packageName=packageName;
		this.prenotationDate=new Date();

	}

	/**
	 * 
	 * getter and setter
	 */
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Flight getOutGoingFlight() {
		return outGoingFlight;
	}

	public void setOutGoingFlight(Flight outGoingFlight) {
		this.outGoingFlight = outGoingFlight;
	}

	public Flight getReturnFlight() {
		return returnFlight;
	}

	public void setReturnFlight(Flight returnFlight) {
		this.returnFlight = returnFlight;
	}

	public Hotel getHotelChosed() {
		return hotelChosed;
	}

	public void setHotelChosed(Hotel hotelChosed) {
		this.hotelChosed = hotelChosed;
	}

	public Excursion getExcursionChosed() {
		return excursionChosed;
	}

	public void setExcursionChosed(Excursion excursionChosed) {
		this.excursionChosed = excursionChosed;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

}
